Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
Listening to "notificationclick" in browsing context

I have set up desktop notifications using:

Notification.requestPermission((result) => {
  if (result === "granted") {
    navigator.serviceWorker.register("/dummy.js").then((registration) => {
      registration.showNotification("Hello", {
        body: "Buzz! Buzz!",
        actions: [{...}],
      });
    });
  }
});

I can't use the Notification constructor, as I need to show buttons (actions) on the notifications, and for some reason the constructor doesn't support this.

I have no intention of firing or listening to the these notifications when the app is not open in a browser tab.

Is there a way to listen to the "notificationclick" and other notification related events from the main browsing context, and not from within the worker?

Alternatively is there any way to use the full set of features on the Notification constructor without having a worker?

To clarify further: I don't need the worker for anything other than using actions on the notifications. I only need to fire notifications / listen to notifications while the app is running in the browser, so I want to interact with the worker as little as possible. Writing logic for notification events in the worker itself is highly undesirable.

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda